package com.hmdp.controller;


import com.hmdp.dto.Result;
import com.hmdp.service.IFollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wzh
 * @since 2022-5-17
 */
@RestController
@RequestMapping("/follow")
public class FollowController {

    @Autowired
    private IFollowService iFollowService;


    /**
     *
     * @param followUserId 关注的用户的id
     * @param isFollow true或false 用于关注或者取关
     * @return
     */
    @PutMapping("/{id}/{isFollow}")
       public Result follow(@PathVariable("id") Long followUserId,@PathVariable("isFollow") Boolean isFollow){
        return  iFollowService.follow(followUserId,isFollow);
       }


       @GetMapping("/or/not/{id}")
       public Result isFollow(@PathVariable ("id") Long followUserId){
        return iFollowService.isFollow(followUserId);
       }


       @GetMapping("/common/{id}")
       public Result followCommon(@PathVariable("id") Long id){
               return iFollowService.followCommons(id);
       }




}
